﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AutoResumeSend.Entity
{
    public class MailInfo
    {



        /// <summary>
        /// 发送人
        /// </summary>
        public string From { get; set; }


        /// <summary>
        /// 接收人
        /// </summary>
        public string To { get; set; }

        /// <summary>
        /// 发送人现实称呼
        /// </summary>
        public string FromDisplayName { get; set; }
        /// <summary>
        /// 主题
        /// </summary>
        public string Subject { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string Body { get; set; }


        public string _attachmentPath = string.Empty;

        /// <summary>
        /// 附件
        /// </summary>
        public System.Collections.Generic.List<System.Net.Mail.Attachment> Attchments
        {

            get
            {
                System.Collections.Generic.List<System.Net.Mail.Attachment> list = null;
                if (!string.IsNullOrEmpty(_attachmentPath))
                {
                    string[] attchmentArr = _attachmentPath.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                    if (attchmentArr != null && attchmentArr.Length > 0)
                    {
                        list = new List<System.Net.Mail.Attachment>();
                        for (int index = 0; index < attchmentArr.Length; index++)
                        {
                            if (index > 5)
                                break;
                            System.Net.Mail.Attachment sAttachment = new System.Net.Mail.Attachment(
                              attchmentArr[index].ToString(), System.Net.Mime.MediaTypeNames.Application.Octet);
                     
                            list.Add(sAttachment);
                        }
                    }
                }

                return list;
             
               
            }

        }



    }
}
